package cn.smqd.ch.upms.client;

import cn.smdq.ch.common.vo.UserVO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

/**
 * @Description TODO
 * @Author shuimodanqing
 * @Date 2019/1/21  1:41 PM
 */
@FeignClient(name = "hope-upms-admin",url = "http://localhost:9091/",fallback = UpmsClient.UpmsClientFallbackImpl.class)
public interface UpmsClient {

    @GetMapping("/user/findUserByUsername/{username}")
    UserVO findUserByUsername(@PathVariable String username);

    @Service
    class UpmsClientFallbackImpl implements UpmsClient{
        private static final Logger logger = LoggerFactory.getLogger(UpmsClientFallbackImpl.class);

        @Override
        public UserVO findUserByUsername(String username) {
            logger.error("调用{}异常:{}","findUserByUsername",username);
            return null;
        }
    }
}
